home *** CD-ROM | disk | FTP | other *** search
- /* Benchmark routines */
-
- #include <stdio.h>
- #include "thread.h"
- #include "synch.h"
-
- shared SpinLock s1;
- shared int numAlive;
-
- c() {ProgramDone();}
-
- b()
- {
- int i = 1000000;
-
- while (--i);
- SpinLockAcquire(&s1);
- if (--numAlive == 0)
- c();
- SpinLockRelease(&s1);
- }
-
- a() {b();}
-
- Main ()
- {
- int i;
-
- SpinLockInit(&s1, "s1");
- numAlive = numProcessors;
- for (i = 0; i < numProcessors; i++)
- (void)ThreadStart(a, NOJOIN, (char *)NULL, 0);
- }
-
-
-